package com.example.demo.dao;

import com.example.demo.util.MySqlProvider;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.UpdateProvider;

/**
 * @Author shaosen
 * @Description //TODO
 * @Date 9:59 2020/6/3
 */
public interface BaseDao<T> {

    /**
     * 新增数据
     *
     * @param bean 实例对象
     * @return 影响行数
     */
    @InsertProvider(type = MySqlProvider.class, method = MySqlProvider.INSERT)
    int insert(T bean);

    @DeleteProvider(type = MySqlProvider.class, method = MySqlProvider.DELETE)
    int delete(@Param("table") String table, @Param("where") String where);

    @UpdateProvider(type = MySqlProvider.class, method = MySqlProvider.UPDATE)
    int update(T bean);
}
